---
import {devkitPages } from '../../../utils/devkit-content-queries'
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
import { render } from 'astro:content';
export async function getStaticPaths() {
  return  await devkitPages()
}

const { doc } = Astro.props
const { slug, title} = Astro.params

if(!doc) {
  throw new Error(`Missing devkit page for ${title} expected at ${slug}`)
}

const { Content, headings } = await render(doc);
---

<StarlightPage
  frontmatter={{
    ...doc.data,
    title: doc.data.title  
  }}
  headings={headings || []}
>
  <Content />
</StarlightPage>
